package cn.tedu.eb_film.service.impl;

import cn.tedu.eb_film.service.UploadService;
import cn.tedu.eb_film.utils.OssUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.util.UUID;

/**
 * @author ライナー・ロンテ
 * @since 2023/3/18 12:20
 */
@Slf4j
@Service
public class UploadServiceImpl implements UploadService {
    @Value("${oss.endpoint}")
    private String endpoint;

    @Value("${oss.accessKeyId}")
    private String accessKeyId;

    @Value("${oss.accessKeySecret}")
    private String accessKeySecret;

    @Value("${oss.bucketName}")
    private String bucketName;

    @Override
    public String upload(MultipartFile file) {
        log.debug("开始处理文件上传");
        return OssUtils.upload(file, endpoint, accessKeyId, accessKeySecret, bucketName);
    }

}
